# from intelliscraper import WebScraper
#
# with open('/test/h1.html','r',encoding='utf-8') as file:
#     html_1 = file.read()
# wanted_list = ['Metal Business Card Blanks']
# scraper = WebScraper(wanted_list,
#                       html=html_1)
# results = scraper.build()
# for result in results:
#     if result.text:
#         print(result.text.strip())
from intelliscraper.utils import find_similar_elements

file_path = '/h1.html'  # 替换为HTML文件的路径
with open(file_path, 'r', encoding='utf-8') as file:
    html_content = file.read()


file_path = '/test/h2.html'  # 替换为HTML文件的路径
with open(file_path, 'r', encoding='utf-8') as file:
    target_html = file.read()

# 使用函数寻找相似元素
similar_elements = find_similar_elements(html_content, target_html, 0.4)
for similar_element in similar_elements:
    print(similar_element)